<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<?php 
	$borrow_check = array(0=>'未检查',1=>'数据已检查');
?>
<div class="form-inline definewidth m20">
	<h3>标的产品简介</h3>
	<table class="table table-bordered table-hover m10">
		 <tr>
		 <td class="tableleft"><?php echo $borrow_type[$borrow['ftype']];?></td>
		</br>
	        <td><?php echo $borrow['title'];?></td>
	        
	        <td class="tableleft">产品亮点</td>
	        <td><?php echo $borrow['summary'];?></td>
	     </tr>
	</table>
	   		
	
	<h3>标的产品描述</h3>
	<table class="table table-bordered table-hover m10">
		<tr>
		 	<td class="tableleft">融资金额</td>
		 	<td><?php echo number_format($borrow['account'],2);?></td>
		 	<td class="tableleft">收益利率</td>
		 	<td><?php echo $borrow['apr'];?>%</td>
		 	<td class="tableleft">标的类型</td>
		 	<td><?php echo $borrow_type[$borrow['ftype']];?></td>
		</tr>
		<tr>
		 	<td class="tableleft"> 标的状态</td>
		 	<td><?php echo $borrow_status[$borrow['fstatus']];?></td>
		 	<td class="tableleft">标的期限</td>
		 	<td><?php if($borrow['is_day'] == 1){echo $borrow['time_limit_day'].'天';}else{$borrow['time_limit'].'个月';}?></td>
		 	<td class="tableleft">投资周期</td>
		 	<td><?php echo $borrow['bill_times'];?>天</td>
		</tr>
		<tr>
		 	<td class="tableleft">标的起始时间</td>
		 	<td><?php echo date('Y-m-d H:i',$borrow['bill_starttime']);?></td>
		 	<td class="tableleft">起息时间</td>
		 	<td><?php echo $borrow_work_time[$borrow['work_time']];?></td>
		 	<td class="tableleft">预约发标时间</td>
		 	<td><?php if($borrow['auto_verify_time'] > 0){ echo  date('Y-m-d H:i',$borrow['auto_verify_time']);}else{echo '&nbsp;';}?></td>
		</tr>
		<tr>
		 	<td class="tableleft">还款日</td>
		 	<td><?php if($borrow['each_time'] > 0){  echo date('Y-m-d H:i',$borrow['each_time']);}else{ echo '&nbsp;';}?></td>
		 	<td class="tableleft">还款方式</td>
		 	<td><?php echo $borrow_style[$borrow['style']];?></td>
		 	<td class="tableleft">投资有效期</td>
		 	<td><?php echo $borrow['valid_time'];?>天</td>
		</tr>
		<tr>
		 	<td class="tableleft">最小投标金额</td>
		 	<td><?php echo number_format($borrow['lowest_account'],2);?>元</td>
		 	<td class="tableleft">最大投标金额</td>
		 	<td><?php echo $borrow['most_account']>0 ? number_format($borrow['most_account'],2)."元":"无限制";?></td>
		 	<td class="tableleft">客户奖励</td>
		 	<td><?php if($borrow['award'] > 0){?><?php echo $borrow_award[$borrow['award']];?>：<font><?php echo $borrow['funds'];?><?php }?></td>
		</tr>
		<tr>
		 	<td class="tableleft">标的安全等级</td>
		 	<td>最高级别</td>
		 	<td class="tableleft">自动投标比例</td>
		 	<td><?php echo $borrow['auto_apr'];?>%</td>
		 	<td class="tableleft">借款用户编号</td>
		 	<td><?php echo $borrow['user_id'];?></td>
		</tr>
		<tr>
		 	<td class="tableleft">担保用户编号</td>
		 	<td><?php echo $borrow['loan_userid'];?> </td>
		 	<td class="tableleft">逾期日利率</td>
		 	<td><?php echo $borrow['late_apr'];?></td>
		 	<td class="tableleft">可逾期天数</td>
		 	<td><?php echo $borrow['late_days'];?>天</td>
		</tr>
	</table>
	
	<h3>背景调查审核</h3>
	<?php if($list){?>
			<?php foreach($list as $val){?>
				<h4><?php echo $borrow_fsubject[$val['id']];?></h4>
				<img width="60px" height="60px" src="<?php echo CONSET_SUBJECT_IMG.$val['pic']?>"/></br> 
				审核资料有效期：<?php echo $val['valid'];?>个月</br> 
				资料提交说明：<?php echo $val['content'];?></br> 
		<?php }?>
       <?php }else{?>
               	暂无数据
        <?php }?>				
	<hr></br>
	
	<h3>标的安全性审核</h3>
	<table class="table table-bordered table-hover m10">

		<?php if($borrow['ftype'] == 1){?>
		<tr>
		 	<td class="tableleft">真伪鉴定</td>
		 	<td><?php echo $borrow['bill_identification'];?></td>
		 	<td class="tableleft">鉴定单位</td>
		 	<td><?php echo $borrow['bill_unit'];?></td>
		 	<td class="tableleft">完好性</td>
		 	<td><?php echo $borrow_good[$borrow['bill_good']];?></td>
		</tr>
		<tr>
		 	<td class="tableleft">字体清晰度</td>
		 	<td><?php echo $borrow['bill_clarity'];?></td>
		 	<td class="tableleft">用章合规性</td>
		 	<td><?php echo $borrow['bill_compliance'];?></td>
		 	<td class="tableleft">担保方</td>
		 	<td><?php echo $borrow['bill_guarantor'];?></td>
		</tr>
		<tr>
		 	<td class="tableleft">承兑银行</td>
		 	<td><?php echo $borrow_bill_bank[$borrow['bill_bank']];?></td>
		 	<td class="tableleft">资金用途</td>
		 	<td><?php echo $borrow['fuse'];?></td>
		 	<td class="tableleft">保障方式</td>
		 	<td><?php echo $borrow['security_mode'];?></td>
		</tr>
		<tr>
		<td class="tableleft">质押借款协议</td>
		 <td colspan="8" ><img style="width:200px; height:200px;"  src="/<?php echo $borrow['bill_protocol'];?>"/></td>
		</tr>
	
		<?php }elseif ($borrow['ftype'] == 2){?>
		<tr>
		 	<td class="tableleft">借款人信息</td>
		 	<td><?php echo $borrow['bill_identification'];?></td>
		 	<td class="tableleft">借款描述</td>
		 	<td><?php echo $borrow['bill_unit'];?></td>
		 	<td class="tableleft">还款来源</td>
		 	<td><?php echo $borrow['bill_clarity'];?></td>
		 	<td class="tableleft">抵押详情</td>
		 	<td><?php echo $borrow['security_mode'];?></td>
		 	<td class="tableleft">产品亮点</td>
		 	<td><?php echo $borrow['summary'];?></td>
		</tr>
		<?php }elseif ($borrow['ftype'] == 3){?>
		<tr>
		 	<td class="tableleft">借款人信息</td>
		 	<td><?php echo $borrow['bill_identification'];?></td>
		 	<td class="tableleft">借款描述</td>
		 	<td><?php echo $borrow['bill_unit'];?></td>
		 	<td class="tableleft">还款来源</td>
		 	<td><?php echo $borrow['bill_clarity'];?></td>
		 	<td class="tableleft">抵押详情</td>
		 	<td><?php echo $borrow['security_mode'];?></td>
		 	<td class="tableleft">产品亮点</td>
		 	<td><?php echo $borrow['summary'];?></td>
		</tr>
		<?php }?>
	</table>

	
	
	<h3>复审</h3>
	<input type="hidden" id="borrow_id" name="borrow_id" value="<?php echo $borrow['id'];?>" />						
		<?php if($borrow['is_verify'] == 1 && $borrow['is_check'] == 1){?>
			<p style="font-weight:bold; color:#009ad9;">初查复查均已通过</p>		
        <?php }elseif($borrow['is_verify'] == 1 && $fshow=='first'){?>
			<p style="font-weight:bold; color:#009ad9;">初查通过</p>
		
		<?php }elseif($borrow['is_verify'] == 2  && $fshow=='first'){?>	
			<p  style="font-weight:bold; color:#f00;">初查失败</p>
			<h4>状态<input type="radio" name="is_verify" id="is_verify" value="1" checked="checked" />初查通过 <input type="radio" name="is_verify" id="is_verify" value="2" />初查不通过</h4>
		<?php }elseif($borrow['is_check']==1  && $fshow=='again'){?>	
			<p style="font-weight:bold; color:#009ad9;">复查通过</p>
		<?php }elseif($borrow['is_check']==2  && $fshow=='again'){?>	
			<p  style="font-weight:bold; color:#f00;">复查失败</p>
			<h4>状态<input type="radio" name="is_check" id="is_check" value="1" checked="checked" />复查通过 <input type="radio" name="is_check" id="is_check" value="2" />复查不通过</h4>
		<?php }elseif($borrow['is_verify'] == 0 && $fshow=='first'){?>	
			<h4>状态<input type="radio" name="is_verify" id="is_verify" value="1" checked="checked" />初查通过 <input type="radio" name="is_verify" id="is_verify" value="2" />初查不通过</h4>
		<?php }elseif($borrow['is_check'] == 0  && $fshow=='again'){?>	
			<h4>状态<input type="radio" name="is_check" id="is_check" value="1" checked="checked" />复查通过 <input type="radio" name="is_check" id="is_check" value="2" />复查不通过</h4>
		<?php }?>
		
	评审留言：<br>
		<textarea rows="8" cols="100" id="repayment_remark" name="repayment_remark"><?php echo trim($borrow['verify_remark']);?></textarea>
	<br>
	  <?php if($borrow['is_check'] != 3 ){?>
	  	 <button type="button" class="btn btn-success"  onclick="borrow_check(<?php echo $borrow['id'];?>);" >审核数据</button>
	  <?php }?>
</div>

<div id="userdialog" style="display:none">
	<div id="view_response"></div>
</div>

<script type="text/javascript">
function borrow_check(borrow_id){
	$.ajax({
		type: "post",
		url: "/sys_admin/borrow/borrow_check/",
		data:"id="+borrow_id+"&is_check="+$('input[name="is_check"]:checked').val()+"&is_verify="+$('input[name="is_verify"]:checked').val()+"&verify_remark="+$('#repayment_remark').val()+"&fshow=<?php echo $fshow;?>",
		success: function(msg){
			if(msg == 1){
				alert("操作成功");
				<?php if($fshow == 'again'){?>
				window.location.href ='/sys_admin/borrow/zhs_borrow_verify_again_list';
				<?php }else{?>
				window.location.href ='/sys_admin/borrow/zhs_borrow_verify_list';
				<?php }?>
				
				
			}else{
				alert("操作失败");
			}
		},
		dataType: "text"
	});
	
}

</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>

